/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 * Description: HISI SFC driver Vendor Hooks
 */

#ifdef CONFIG_MTD_HISI_SFC

#if !defined(HISI_SFC_H) || defined(TRACE_HEADER_MULTI_READ)
#define HISI_SFC_H
#include <linux/mtd/spi-nor.h>
#include <linux/spi/spi.h>
#include "core.h"

void trace_hisi_sfc_erase_update_counter(struct spi_nor *nor, int len, int ret);
void trace_hisi_sfc_read_update_counter(struct spi_nor *nor, int len, int ret);
void trace_hisi_sfc_write_update_counter(struct spi_nor *nor, int len, int ret);
int trace_hisi_sfc_get_sfdp_info(struct spi_nor *nor, struct flash_info **info);
void trace_hisi_sfc_set_add_width(struct spi_nor *nor);
void trace_hisi_sfc_set_dev_id(const struct flash_info *info);
void trace_hisi_sfc_devinfo_show(struct spi_nor *nor, struct mtd_info *mtd);
#endif

#else

#include <linux/tracepoint.h>
struct spi_nor;
struct flash_info;
struct mtd_info;

DECLARE_EVENT_NOP(hisi_sfc_erase_update_counter,
	TP_PROTO(struct spi_nor *nor, int len, int ret),
	TP_ARGS(nor, len, ret));

DECLARE_EVENT_NOP(hisi_sfc_read_update_counter,
	TP_PROTO(struct spi_nor *nor, int len, int ret),
	TP_ARGS(nor, len, ret));

DECLARE_EVENT_NOP(hisi_sfc_write_update_counter,
	TP_PROTO(struct spi_nor *nor, int len, int ret),
	TP_ARGS(nor, len, ret));

int trace_hisi_sfc_get_sfdp_info(struct spi_nor *nor, struct flash_info **info)
{
	return 0;
}

DECLARE_EVENT_NOP(hisi_sfc_set_add_width,
	TP_PROTO(struct spi_nor *nor),
	TP_ARGS(nor));

DECLARE_EVENT_NOP(hisi_sfc_set_dev_id,
	TP_PROTO(const struct flash_info *info),
	TP_ARGS(info));

DECLARE_EVENT_NOP(hisi_sfc_devinfo_show,
	TP_PROTO(struct spi_nor *nor, struct mtd_info *mtd),
	TP_ARGS(nor, mtd));

#endif

